﻿namespace IceCS.DesignPattern.Core.FactoryPattern.WorldShape
{
    /// <summary>
    /// 图形类型
    /// </summary>
    public enum ShapeType
    {
        Circle,
        Rectangle,
        Square
    }

    /// <summary>
    /// 图形工厂
    /// </summary>
    public class ShapeFactory
    {
        //使用 getShape 方法获取形状类型的对象
        public IShapeAction GetShape(ShapeType type)
        {
            return type switch
            {
                ShapeType.Circle => new Circle(),
                ShapeType.Square => new Square(),
                ShapeType.Rectangle => new Rectangle(),
                _ => null,
            };
        }
    }
}

